package com.spring.resource;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class MessageFactory {
	private static List<String> messageSource;
	protected static final Log logger = LogFactory.getLog(MessageFactory.class);
	
	public static Properties getMessage (){
		
		Properties properties = new Properties();
		try {
		    for (Iterator<String> iterator = messageSource.iterator(); iterator.hasNext();) {
		    	String file = (String) iterator.next();
		    	properties.load(new FileInputStream(file));
			}
			
		    
		} catch (IOException e) {
			logger.error("Errore durante caricamento file di properties per messaggi mail");
		}
		
		return properties;
	}
	
	
	public List<String> getMessageSource() {
		return messageSource;
	}

	public void setMessageSource(List<String> messageSource) {
		this.messageSource = messageSource;
	}


	
	
	
}
